package org.springframework.extend.persistence.repository.service;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.extend.persistence.repository.PersistenceRepositoryTestContstants;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcOperations;
import org.springframework.stereotype.Repository;

@Repository
public class StandardEmployeeDao implements EmployeeDao {

	@Autowired
	private SimpleJdbcOperations	template;

	public Employee get(int id) {
		ParameterizedRowMapper<Employee> rm = new ParameterizedRowMapper<Employee>(){
			public Employee mapRow(ResultSet rs, int rowNum) throws SQLException {
				return null;
			}
		};
		
		return (Employee) template.queryForObject(PersistenceRepositoryTestContstants.QUERY_ID.GET_EMPLOYEE_BY_ID, rm, new Integer(100));
	}
	// public Employee get(int id) {
	// Map<String, Object> result = template.queryForMap(
	// PersistenceRepositoryTestContstants.QUERY_ID.GET_EMPLOYEE_BY_ID, new Integer(100));
	//		
	// return new Employee((Integer) ((BigDecimal) result.get("EMPLOYEE_ID")).intValue());
	// }

}
